import Abstract from '../abstract';

class videoItemAPI extends Abstract {

    videoItemList(data: { id: string }) {
        return this.getReq({url: 'VideoItem.video_item', params: data});
    }

    addVideoItem(data: { name: string; sort?: any }) {
        return this.postReq({url: 'VideoItem.video_item_add', data});
    }

    editVideoItem(data: any) {
        return this.postReq({url: 'VideoItem.video_item_edit', data});
    }

    deleteVideoItem(data: { id: string }) {
        return this.getReq({url: 'VideoItem.video_item_delete', params: data});
    }

    addHistory(data) {
        return this.postReq({url: 'VideoItem.video_item_addHistory',  data});
    }

    getHistoryOne(data) {
        return this.getReq({url: 'VideoItem.video_item_getHistoryOne',  params: data});
    }

    getHistoryList() {
        return this.getReq({url: 'VideoItem.video_item_getHistoryList'});
    }
}

// 单列模式返回对象
let instance;
export default (() => {
    if (instance) return instance;
    instance = new videoItemAPI();
    return instance;
})();
